/*
 *  commandLine.cpp
 *  allInOne
 *
 *  Created by James Johns on 31/10/2009.
 *  Copyright 2009 xD-Duncesoft. All rights reserved.
 *
 */

#include "commandLine.h"
#include <string>
#include <iostream>

commandLine::commandLine() {
	
}

commandLine::~commandLine() {
	
}

void commandLine::getInput(char *inputBuffer){
	for(int i=0; i<INPUT_BUFFER_SIZE; i++) {
		inputBuffer[i] = input[i] = 0x00;									// null input buffer to limit conflicts
	}
	
	std::cin.getline(input,INPUT_BUFFER_SIZE);								// get input and send to input buffer
	
	
	strcpy(inputBuffer, input);
	/*
	 int i = 0;
	
	while (input[i] != 0x00) {
		input[i] = inputBuffer[i];							// copy <char *inputBuffer> to <char input[256]>
		i++;
	}
	input[i] = 0x00;
	*/
}

void commandLine::print(const char *output) {
	std::cout << output;									// print content of <const char *output>
}

void commandLine::requestCommand(const char *commandText, char *commandBuffer) {
	print(commandText);										// print the command request
	getInput(commandBuffer);								// get input from user and send to <char *commandBuffer>
}

